﻿//common function start
function $strLenGB(v){
	//一个中文按照两个字节算，返回长度
	return v.replace(/[\u00FF-\uFFFF]/g,"  ").length;
};
function $isMobile(v){
/*
　　中国移动号段 1340-1348 135 136 137 138 139 150 151 152 157 158 159 187 188 147 182
　　中国联通号段 130 131 132 155 156 185 186 145
　　中国电信号段 133 1349 153 180 189
*/	
	var cm="134,135,136,137,138,139,150,151,152,157,158,159,187,188,147,182,183",
		cu="130,131,132,155,156,185,186,145",
		ct="133,153,180,189",
		v=v||"",
		h1=v.substring(0,3),
		h2=v.substring(0,4),
		v=(/^1\d{10}$/).test(v)?(cu.indexOf(h1)>=0?"联通":(ct.indexOf(h1)>=0?"电信":(h2=="1349"?"电信":(cm.indexOf(h1)>=0?"移动":"未知")))):false;
	//首先找是否联通，然后查找是否电信，然后在移动中查找‘1349’为电信，最后在移动中查找
	return v; 
};
function $isMail(v){
	return /^([a-zA-Z0-9]+[_|\-|\.]?)*[a-zA-Z0-9]+@([a-zA-Z0-9]+[_|\-|\.]?)*[a-zA-Z0-9]+\.[a-zA-Z]+$/.test(v)
};
function $option(){
    var pt=arguments[0];
    for(var i=1,len=arguments.length;i<len;i++){
        for(var k in arguments[i]){
            pt[k]=arguments[i][k]
        }
    }

    return pt;
}
function $makeUrl(data){
	//将json串组装成为url并返回
	var arr=[];
	for( var k in data) {
		arr.push(k+"="+data[k]);
	};
	return arr.join("&");
};
function $array_walk(arr,func){
	for(var i=0;i<arr.length;i++){
		func(i,arr[i]);
	}
}
function $child(node,val,fn,filter){
	var results=[], filter = filter||$empty();
        if(!node) return results;
		
	walk(node.firstChild,function(n){
		if(!n){return ;}
		var actual=n.nodeType===1&&n.nodeName.toLowerCase();
		if(typeof actual === 'string' && (actual === val || typeof val !== 'string') && filter(n)){
				results.push(n);
				fn&&fn(n,results.length-1);
		}
	});
	
	return results;
			
	function walk(n,func){
		func(n);
		while(n&&(n=n.nextSibling)){
			func(n,func);		
		}
	}
}
function $getParent(el,targetTag,maxSearchDeep){
	while(el && el.tagName.toLowerCase()!=targetTag && maxSearchDeep>0){
		el = el.parentNode;
		maxSearchDeep--;
	}
	if(el && el.tagName.toLowerCase()!=targetTag){
		return null;
	}
	return el;
}
function $empty(){
//返回全局空函数，不做任何事情，返回true；
   return function(){return true;}
}
function $addClass(ids,cName){
	$setClass(ids,cName,"add");	
};
function $addEvent(obj, type, handle) {
    if(!obj || !type || !handle) {
        return;
    }
    if( obj instanceof Array) {
        for(var i = 0, l = obj.length; i < l; i++) {
            $addEvent(obj[i], type, handle);
        }
        return;
    }
    if( type instanceof Array) {
        for(var i = 0, l = type.length; i < l; i++) {
            $addEvent(obj, type[i], handle);
        }
        return;
    }
    window.__allHandlers = window.__allHandlers || {};
    window.__Hcounter = window.__Hcounter || 1;
    function setHandler(obj, type, handler, wrapper) {
        obj.__hids = obj.__hids || [];
        var hid = 'h' + window.__Hcounter++;
        obj.__hids.push(hid);
        window.__allHandlers[hid] = {
            type : type,
            handler : handler,
            wrapper : wrapper
        }
    }
    function createDelegate(handle, context) {
        return function() {
            return handle.apply(context, arguments);
        };
    }
    if(window.addEventListener) {
        var wrapper = createDelegate(handle, obj);
        setHandler(obj, type, handle, wrapper)
        obj.addEventListener(type, wrapper, false);
    }
    else if(window.attachEvent) {
        var wrapper = createDelegate(handle, obj);
        setHandler(obj, type, handle, wrapper)
        obj.attachEvent("on" + type, wrapper);
    }
    else {
        obj["on" + type] = handle;
    }
};
function $bindEvent(name,type,handle){
	//专用于批量绑定名字相同的事件,单独绑定直接写onclick等
	var objs=document.getElementsByName(name);
	for(var i=0,len=objs.length;i<len;i++){
		$addEvent(objs[i],type,handle);
	}
}
function $delClass(ids,cName){	
	$setClass(ids,cName,"remove");
};
function $empty(){
//返回全局空函数，不做任何事情，返回true；
   return function(){return true;}
};
function $getHeight(e){
	   var show = e.style.display;
	   show=="none"&&(e.style.display = "");
	   var box = e.getBoundingClientRect();
	   var h = box.height?box.height:(box.bottom-box.top);
	   e.style.display = show;
	   return h;
};
function $getParent(el,targetTag,maxSearchDeep){
	while(el && el.tagName.toLowerCase()!=targetTag && maxSearchDeep>0){
		el = el.parentNode;
		maxSearchDeep--;
	}
	if(el && el.tagName.toLowerCase()!=targetTag){
		return null;
	}
	return el;
};
function $getTarget(e,parent,tag) {
	var	e=window.event||e,
		tar=e.srcElement||e.target;
	if(parent && tag && tar.nodeName.toLowerCase()!=tag){
		while(tar = tar.parentNode){
			//对下拉框的点击会回溯到document，其它最多回溯到document.body即可
			if(tar==parent || tar==document.body || tar==document){
				return null;
			}else if(tar.nodeName.toLowerCase()==tag){
				break;
			}
		}
	};
	return tar;
};
function $getY(e){
//获取页面中对象的绝对Y位置
	var t=e.offsetTop || 0;
	while(e=e.offsetParent){
		t+=e.offsetTop;
	}
	return t;
};
function $getYP(e){
	//获取页面中对象的绝对Y位置，如果是隐藏的，则尝试获取其父节点位置
	var t = $getY(e),e = e.parentNode;   
	
	while(0===t && document.body != e){
		t = $getY(e);   
		e = e.parentNode;
	}
	
    return t;
};
function $hasClass(old,cur){
	if(!old||!cur) return null;
	var arr = (typeof old == 'object' ? old.className : old).split(' ');
	for(var i=0,len=arr.length;i<len;i++){
		if(cur==arr[i]){
			return cur;
		}
	};
	return null;
};

function $inArray(t,arr){
	if(arr.indexOf){
		return arr.indexOf(t);
	}
	for(var i=arr.length;i--;){
		if(arr[i]===t){
			return i*1;
		}
	};
	return -1;
};
function $isBrowser(str){
	str=str.toLowerCase();
	var b=navigator.userAgent.toLowerCase();
	var arrB=[];
	arrB['firefox']=b.indexOf("firefox")!=-1;
	arrB['opera']=b.indexOf("opera")!=-1;
	arrB['safari']=b.indexOf("safari")!=-1;
        arrB['chrome']=b.indexOf("chrome")!=-1;
	arrB['gecko']=!arrB['opera']&&!arrB['safari']&&b.indexOf("gecko")>-1;
	arrB['ie']=!arrB['opera']&&b.indexOf("msie")!=-1;
	arrB['ie6']=!arrB['opera']&&b.indexOf("msie 6")!=-1;
	arrB['ie7']=!arrB['opera']&&b.indexOf("msie 7")!=-1;
        arrB['ie8']=!arrB['opera']&&b.indexOf("msie 8")!=-1;
        arrB['ie9']=!arrB['opera']&&b.indexOf("msie 9")!=-1;
        arrB['ie10']=!arrB['opera']&&b.indexOf("msie 10")!=-1;
	return arrB[str];
};
function $mouseout(obj,func){
	obj.onmouseout=function(e){
		var e=window.event||e,
			target=e.toElement || e.relatedTarget,
			parent=target;
		while ( parent && parent !== this ) {
			parent = parent.parentNode;
		}	
		if ( parent !== this ) {
			func(this);
		}
	}
};
function $mouseover(obj,func){
	obj.onmouseover=function(e){
		var e=window.event||e,
			target=e.fromElement || e.relatedTarget,
			parent=target;
		while ( parent && parent !== this ) {
			parent = parent.parentNode;
		}	
		if ( parent !== this ) {
			func(this);
		}
	}
};

function $setClass(ids, cName, kind) {
	if(!ids) {
		return;
	}
	var set = function(obj, cName, kind) {
		if(!obj) {
			return;
		}
		var oldName = obj.className, arrName = oldName ? oldName.split(' ') : [];
		if(kind == "add") {
			if(!$hasClass(oldName, cName)) {
				arrName.push(cName);
				obj.className = arrName.join(' ');
			}
		}
		else if(kind == "remove") {
			var newName = [];
			for(var i = 0, l = arrName.length; i < l; i++) {
				if(cName != arrName[i] && ' ' != arrName[i]) {
					newName.push(arrName[i]);
				}
			}
			obj.className = newName.join(' ');
		}
	};
	if( typeof (ids) == "string") {
		var arrDom = ids.split(",");
		for(var i = 0, l = arrDom.length; i < l; i++) {
			if(arrDom[i]) {
				set($id(arrDom[i]), cName, kind);
			}
		}
	}
	else if( ids instanceof Array) {//DOM对象集合  array
		for(var i = 0, l = ids.length; i < l; i++) {
			if(ids[i]) {
				set(ids[i], cName, kind);
			}
		}
	}
	else {
		set(ids, cName, kind);
	}
};
function $strTrim(str,code){
//删除字符串两端的空格或者指定内容
	var argus  = code || "\\s";
	var temp = new RegExp("(^"+argus+"*)|("+argus+"*$)","g");
	return str.replace(temp,"");
}
function $getNext(elem) {
	do {
		elem = elem.nextSibling;
	}while(elem && elem.nodeType != 1);

	return elem;
}
function $getValue(name){
	//专门用于check和radio取值，单独取值请直接写value
	var objs=document.getElementsByName(name),
		returnvar=[];
	for(var i=0,len=objs.length;i<len;i++){
		var t=objs[i];
		if(t.tagName.toLowerCase()=="input"){
			if((t.type.toLowerCase()=="checkbox" || t.type.toLowerCase()=="radio") ){	//设置单选复选框的值
				if(t.checked==true){
					returnvar.push(t.value);
				}
			}
		}
	};
	returnvar=returnvar.join(',');
	return returnvar;
}
function $setHtml(o,html){
    if(o&&o.nodeType==1){
        o.innerHTML=$xss(html,"none");
    }
}
function $xss(str,type){
	//空过滤
	if(!str){
		return str===0 ? "0" : "";
	}
	
	switch(type){
		case "none": //过度方案
			return str+"";
		break;
		case "html": //过滤html字符串中的XSS
			return str.replace(/[&'"<>\/\\\-\x00-\x09\x0b-\x0c\x1f\x80-\xff]/g, function(r){
				return "&#" + r.charCodeAt(0) + ";"
			}).replace(/ /g, "?").replace(/\r\n/g, "<br />").replace(/\n/g,"<br />").replace(/\r/g,"<br />");
		break;
		case "htmlEp": //过滤DOM节点属性中的XSS
			return str.replace(/[&'"<>\/\\\-\x00-\x1f\x80-\xff]/g, function(r){
				return "&#" + r.charCodeAt(0) + ";"
			});
		break;
		case "url": //过滤url
			return escape(str).replace(/\+/g, "%2B");
		break;
		case "miniUrl":
			return str.replace(/%/g, "%25");
		break;
		case "script":
			return str.replace(/[\\"']/g, function(r){
				return "\\" + r;
			}).replace(/%/g, "\\x25").replace(/\n/g, "\\n").replace(/\r/g, "\\r").replace(/\x01/g, "\\x01");
		break;
		case "reg":
			return str.replace(/[\\\^\$\*\+\?\{\}\.\(\)\[\]]/g, function(a){
				return "\\" + a;
			});
		break;
		default:
			return escape(str).replace(/[&'"<>\/\\\-\x00-\x09\x0b-\x0c\x1f\x80-\xff]/g, function(r){
				return "&#" + r.charCodeAt(0) + ";"
			}).replace(/ /g, "?").replace(/\r\n/g, "<br />").replace(/\n/g,"<br />").replace(/\r/g,"<br />");
		break;
	}
}
function $display(ids,state){//下面的逻辑需要进一步优化
	if(!ids){
		return;
	}
	var state=state||'';
	if(typeof(ids)=="string"){
		var arr=ids.split(',');		
		for(var i=0,len=arr.length;i<len;i++){
			var o=$id(arr[i]);
			o && (o.style.display=state);
		}
	}else if(ids.nodeType){//强制判断是否为dom节点，避免走到下面判断数组环节
		ids.style.display=state;
	}else if(ids.length){//对长度判断会导致一些拥有length属性的dom元素出错
		for(var i=0,len=ids.length;i<len;i++){
			$display(ids[i],state)
		}
	}else{
		ids.style.display=state;
	}
}
function $getContentHeight(){
//获取页面内容的实际高度
var bodyCath=document.body;
var doeCath=document.compatMode=='BackCompat'?bodyCath:document.documentElement;
return (window.MessageEvent&&navigator.userAgent.toLowerCase().indexOf('firefox')==-1)?bodyCath.scrollHeight:doeCath.scrollHeight;
};
function $getContentWidth(){
//获取页面内容的实际宽度
	var bodyCath=document.body;
	var doeCath=document.compatMode=='BackCompat'?bodyCath:document.documentElement;
	return (window.MessageEvent&&navigator.userAgent.toLowerCase().indexOf('firefox')==-1)?bodyCath.scrollWidth:doeCath.scrollWidth;
};
function $getMousePosition(e){
	//获取鼠标的位置
	var e=window.event?window.event:e;
	// 兼容老的用法，避免重新生成时出错。
	if(e.evt) e=e.evt;
	var pos=[];
	if(typeof e.pageX!="undefined"){
		pos=[e.pageX,e.pageY];
	}else if(typeof e.clientX!="undefined"){
		pos=[e.clientX+$getScrollPosition()[0],e.clientY+$getScrollPosition()[1]];
	}
	return pos;
};
function $getPageScrollHeight(){
	var bodyCath=document.body;
	var doeCath=document.compatMode=='BackCompat'?bodyCath:document.documentElement;
	var ua = navigator.userAgent.toLowerCase();
	return (window.MessageEvent && ua.indexOf('firefox')==-1 && ua.indexOf('opera')==-1&&ua.indexOf('msie')==-1)?bodyCath.scrollTop:doeCath.scrollTop;
};
function $getPageScrollWidth(){
	var bodyCath=document.body;
	var doeCath=document.compatMode=='BackCompat'?bodyCath:document.documentElement;
	return (window.MessageEvent&&navigator.userAgent.toLowerCase().indexOf('firefox')==-1)?bodyCath.scrollLeft:doeCath.scrollLeft;
};
function $getScrollPosition(){
	//获取滚动条的位置
	var scrollLeft = document.documentElement.scrollLeft || document.body.scrollLeft || window.pageXOffset;
	var scrollTop = document.documentElement.scrollTop || document.body.scrollTop || window.pageYOffset;
	return [scrollLeft ? scrollLeft : 0, scrollTop ? scrollTop : 0];
};
function $getWindowHeight(){
	var bodyCath=document.body;
	return (document.compatMode=='BackCompat'?bodyCath:document.documentElement).clientHeight;
};
function $getWindowWidth(){
	var bodyCath=document.body;
	return (document.compatMode=='BackCompat'?bodyCath:document.documentElement).clientWidth;
};

function $initDragItem(opt) {
	//控制组件拖动方法
	var option = {
		barDom : "", //拖动区域的dom对象
		targetDom : "" //被拖动区域的dom对象
	};
	for(var i in opt) {
		option[i] = opt[i];
	}
	var that = arguments.callee;
	that.option ? "" : that.option = {};
	//设置状态
	option.barDom.style.cursor = 'move';
	option.targetDom.style.position = "absolute";
	option.barDom.onmousedown = function(e) {
		var e = window.event || e;
		that.option.barDom = this;
		that.option.targetDom = option.targetDom;
		var currPostion = [parseInt(option.targetDom.style.left) ? parseInt(option.targetDom.style.left) : 0, parseInt(option.targetDom.style.top) ? parseInt(option.targetDom.style.top) : 0];
		that.option.diffPostion = [$getMousePosition({
		evt: e
		})[0] - currPostion[0], $getMousePosition({
		evt: e
		})[1] - currPostion[1]];
		document.onselectstart = function() {
			return false;
		};
		window.onblur = window.onfocus = function() {
			document.onmouseup();
		};
		return false;
	};
	option.targetDom.onmouseup = document.onmouseup = function() {
		if(that.option.barDom) {
			that.option = {};
			document.onselectstart = window.onblur = window.onfocus = null;
		}
	};
	option.targetDom.onmousemove = document.onmousemove = function(e) {
		try {
			var e = window.event || e;
			if(that.option.barDom && that.option.targetDom) {
				that.option.targetDom.style.left = ($getMousePosition({
				evt: e
				})[0] - that.option.diffPostion[0]) + "px";
				that.option.targetDom.style.top = ($getMousePosition({
				evt: e
				})[1] - that.option.diffPostion[1]) + "px";
			}
		}
		catch (e) {
		}
	};
};
//common function end
//组件函数
//slider start
function $slider(obj){
    var opt={
        titleId:"",    			//tab标题的id
        titleTag:"",    		//tab的元素类型
        contentId:"",    		//内容的id
        contentTag:"",    		//内容元素类型
		prevId:"",				//前一页
		nextId:"",				//下一页
		perView:1,				//每页显示个数
		className:"current",	//title选中的样式
		eventType:"mouseover",	//mouseover && click
        initIndex:NaN,			//初始化定位
        timeLag:300,			//启动延时，防止用户滑来滑去的情况
		funcInit:$empty(),		//初始化循环内容时候执行的函数
		funcTabInit:$empty(),	//初始化循环title时候执行的函数
		func:$empty(),			//当前元素显示时候执行的函数
        nodeWalker : null,      //遍历元素的方法,此函数需要做以下几件事情:1.遍历  2.筛选(可选) 3.返回结果集,另外此函数需要处理title和content两种情况
		auto:false,				//是否自动轮播
		autoKeep:true,			//鼠标移开后继续轮播
		autoTimes:100,			//轮播次数
		autoLag:5000,			//自动轮播延时
		fadeLag:50,				//效果延时
		fadeTimes:500,			//效果要求执行时间，比如0.5s切换完成，而效果延时是0.1s，那么就是说五个步骤之后就执行完毕了
		initSpeed:100,			//初速度加成
		effect:'none',          //播放效果 'none','scrollx', 'scrolly', 'fade'
		width:0,				//内容区宽度
		height:0,				//内容区高度
		backAttr:"back_src",	//存储图片地址的属性
		isLoadInit:true	,		//初始化的时候是否载入图片，当切换在屏幕不可见范围内进行的时候有用
		focusIndex:setEffect,	//提供给外部定位的接口
		clearAuto:function(){clearInterval(autoIntr)},//提供给外部的接口，清空轮播
		cont:null,				//内容列表
		tabs:null			//菜单列表
    };

    for(var i in obj){opt[i]=obj[i]};

	//自动获取的宽高不太准确，需要传入
	((opt.width==0 && opt.effect=="scrollx") || (opt.height==0 && opt.effect=="scrolly")) && (opt.effect="none");

	//if(!opt.titleId) debugger;
    //遍历所有的标题和内容，并绑定事件
    var	total=0,		//统计数字
		autoCount=0,	//当前已播次数
		isInit=true,	//是否初始化进入;
		intr=null,		//tab切换的interval
		autoIntr=null,	//自动切换的interval
		 _imgs=[];		//图片是否已经载入


	if(opt.contentId){
		//支持只有tab切换然后做别的事情的情况
		var oContent=$id(opt.contentId),
			_cont=(opt.nodeWalker||$child)(oContent,opt.contentTag,function(dom){
			//给内容的状态初始化
			switch(opt.effect){
				case "none":
					dom.style.display="none";
				break;
				case "scrollx":
					//考虑到动态加载图片的情况，区域的大小要限定
					dom.style.width=opt.width+"px";
					//如果效果为scrollx和fade，则全部向右漂移
					dom.style.styleFloat = dom.style.cssFloat = "left";
					dom.style.visibility = "hidden";
				break;
				case "scrolly":
					//考虑到动态加载图片的情况，区域的大小要限定
					dom.style.height=opt.height+"px";
					dom.style.visibility = "hidden";
				break;
				case "fade":
					dom.style.display="none";
					dom.style.position="absolute";
					dom.style.left=0;
					dom.style.top=0;
				break;
			};
			//执行初始化函数
			opt.funcInit(total++,dom);
		});

		if(opt.auto){
			//循环播放进入和离开content的操作
			$addEvent(oContent,"mouseover",function(){
				clearInterval(autoIntr);
			});
			opt.autoKeep && $addEvent(oContent,"mouseout",function(){
				setAuto();
			});
		};
		opt.cont=_cont;
	}

	//如果没有定义initIndex则随机
	var len=opt.perView,//下面多次用到，所以存储一下
		now=0;			//临时变量，当前显示的元素

	if(opt.titleId){
		//支持无titile切换
		var oTitle=$id(opt.titleId),
			_tabs=(opt.nodeWalker||$child)(oTitle,opt.titleTag,function(dom){
				opt.funcTabInit(now,dom);
				dom.setAttribute("index",now++);
			});

		$addEvent(oTitle,opt.eventType,function(e){
			var tar=$getTarget(e,oTitle,opt.titleTag);
			if(tar && $inArray(tar,_tabs)!=-1){
				//放置current还没有设置为cur，然后鼠标又触发的状况
				//setClass在current=cur之前
				var cur=tar.getAttribute("index")*1;
				clearInterval(autoIntr);
				if(cur!=current){
					intr=setTimeout(function(){
						setEffect(cur);
					},opt.timeLag);
				}
			}
		});

		$addEvent(oTitle,"mouseout",function(e){
			var tar=$getTarget(e,oTitle,opt.titleTag);
			if(tar){
				//clearInterval(autoIntr);
				clearTimeout(intr);
				opt.auto && opt.autoKeep && setAuto();
			}
		});
		opt.tabs=_tabs;
		total=now;
	};

	var	pageTotal=Math.ceil(total/len),	//分页
		current=isNaN(opt.initIndex)?$randomInt(pageTotal):opt.initIndex,
		autoTotal=opt.autoTimes * total - 1; //总共轮播次数;


	//默认展示配置项目
	setEffect(current);

	//判断是否自动切换
	opt.auto && setAuto();

	//绑定上一个、下一个的点击
	opt.prevId && (
		$id(opt.prevId).onclick=function(e){
			$preventDefault(e);
			clearInterval(autoIntr);
			setEffect((now=current-1)<0?(pageTotal-1):now);
		}
	);

	opt.nextId && (
		$id(opt.nextId).onclick=function(e){
			$preventDefault(e);
			clearInterval(autoIntr);
			setEffect((now=current+1)>=pageTotal?0:now);
		}
	)

	//初始化结束
	isInit=false;

	return opt;

	//自动切换设置
	function setAuto(){
		autoIntr && clearInterval(autoIntr);
		autoIntr=setInterval(function(){
			if(autoCount>=autoTotal){
				clearInterval(autoIntr);
			}else{
				setEffect((now=current+1)>=pageTotal?0:now);
				autoCount++;
			}
		},opt.autoLag);
	}

	//设置特效
	function setEffect(cur){
		//if(opt.isLoadInit==false) debugger;
		if(!opt.contentId){
			//如果没有contentId，简单解决
			showItem(cur);
			current=cur;
			return;
		};
		if(isInit){
			//初始化动态效果
			switch(opt.effect){
				case "scrollx":
					oContent.style.position="relative";
					oContent.style.width=(total+1) * opt.width +"px";
					oContent.style.left=-current*opt.width+"px";
				break;
				case "scrolly":
					oContent.style.position="relative";
					oContent.style.top=-current*opt.height+"px";
				break;
				case "fade":
					oContent.style.position="relative";
				break;
			};
			for(var i=0;i<len;i++){
				(now = cur+i) < total && showItem(now);
			};
			current=cur;
		}else{
			//传入来之前应确保cur!=curren，否则会被当作是初始化
			var fadeStep=Math.floor(opt.fadeTimes/opt.fadeLag),	//计算效果步骤
				fadeIntr=null,
				fadeCount=0;
			//全局的特效定时器，表示一个组件一个活动周期中只能出现一个特效，如果已经存在了，那边必须先结束这个特效才能继续执行
			if(opt.globeFadeIntr){
				switch(opt.effect){
					case "fade":
						//oContent.style.top=-endTop+"px";
						//如果不加zIndex问题，某些情况下会有问题，例如title提示
						_cont[current].style.zIndex=0;
						_cont[cur].style.zIndex=1;
						//当连续触发多个淡出计算的过程中，会出现重影，这段代码在完成时对透明度做最后的调整
						_cont[current].style.filter="alpha(opacity=0)";
						_cont[current].style.opacity=0;
						_cont[cur].style.filter="alpha(opacity=1)";
						_cont[cur].style.opacity=1;
						current=cur;
						break;
				}
				clearInterval(opt.globeFadeIntr);
			}
			//全局的特效定时器，清空，开始下一个特性
			opt.globeFadeIntr=null;
			switch(opt.effect){
				case "none":
					//if(len>1) debugger;
					for(var i=0;i<len;i++){
						(now = current*len+i) < total && (_cont[now].style.display="none");
						(now = cur*len+i) < total && showItem(now);
					};
					current=cur;
				break;
				case "scrollx":
					var left=getSpeed(opt.width);
					showItem(cur);
					opt.globeFadeIntr=fadeIntr=setInterval(function(){
						//debugger;
						if(fadeCount++>=fadeStep){
							clearInterval(fadeIntr);
							opt.globeFadeIntr=null;
							oContent.style.left=-left.end+"px";
							current=cur;
						}else{
							oContent.style.left=-getMove(left)+"px";
							left.t = left.t<opt.fadeTimes?(left.t+opt.fadeLag):opt.fadeTimes;
						};
					},opt.fadeLag);
				break;
				case "scrolly":
					//debugger;
					var top=getSpeed(opt.height);
					showItem(cur);
					opt.globeFadeIntr=fadeIntr=setInterval(function(){
						//debugger;
						if(fadeCount++>=fadeStep){
							clearInterval(fadeIntr);
							opt.globeFadeIntr=null;
							oContent.style.top=-top.end+"px";
							current=cur;
						}else{
							oContent.style.top=-getMove(top)+"px";
							top.t = top.t<opt.fadeTimes?(top.t+opt.fadeLag):opt.fadeTimes;
						};
					},opt.fadeLag);
				break;
				case "fade":
					showItem(cur);
					opt.globeFadeIntr=fadeIntr=setInterval(function(){
						//if(!opt.titleId) debugger;
						if(fadeCount++>=fadeStep){
							clearInterval(fadeIntr);
							opt.globeFadeIntr=null;
							//oContent.style.top=-endTop+"px";
							//如果不加zIndex问题，某些情况下会有问题，例如title提示
							_cont[current].style.zIndex=0;
							_cont[cur].style.zIndex=1;
							current=cur;
						}else{
							var per=fadeCount/fadeStep;

							_cont[current].style.filter="alpha(opacity="+(1-per)*100+")";
							//_cont[current].style.MozOpacity=1-per;
							_cont[current].style.opacity=1-per;

							_cont[cur].style.filter="alpha(opacity="+(per*100)+")";
							//_cont[cur].style.MozOpacity=per;
							_cont[cur].style.opacity=per;
						};
					},opt.fadeLag);
				break;
			};
		}

		function getSpeed(s){
			var flag=(cur - current)<0?-1:1,
				end=cur*s,
				here=(cur - flag)*s,//直接定位到它的前一个
				oFirst=_cont[0];
			current == 0 && (oFirst.style.position="static");
			if(current + 1 == total && cur == 0){
				//如果是最后一个到第一个情况，仍然保持向左侧滑动
				flag = 1;
				end=(current+1)*s;
				here=current*s;
				oFirst.style.position="relative";
				opt.effect=="scrollx"?oFirst.style.left=end + "px":oFirst.style.top=end + "px";
			};
			return {
				t:0,
				distance:flag*s,
				end:end,
				here:here
			}
		}

		function getMove(obj){
		  //举一个简单的例子，一个div要向右缓动，left初始值是50，那么b就是50，要向右移动100，那c就是100，如果知道的是目标值，例如要向右移动到150，那就把目标值150减初始值b就是变化量c了。
		  //至于d的设置就比较灵活，只要符合t是从0向d递增（或递减）就可以了。
		  //d跟步长配合使用来设置持续时间，例如d设置为100，如果设置步长是10，那么从0到100就有10步，即分10次来完成这个过程，步数越多那么持续时间就越长。
		  //至于t的变化相当于时间的变化，一般是均匀变化的，每次变化都增加一个步长，当t从0递增（或递减）到d时，缓动就结束了。
		  //要注意的是t是从0开始的，设置步长时必须确定t确实能到达d，如果上面的步长是3，那么t就永远都到不了d了。更好的处理是当t等于或超过d之后，就停止定时器并设置当前值为目标值。
			var b=obj.here,
				c=obj.distance,
				d=opt.fadeTimes,
				t=obj.t/d-1;
			return parseInt(-c * (t*t*t*t - 1) + b,10);
		}

		function showItem(cur){
			//设定当前元素的状态
			//if(opt.effect=="none") debugger;
			//设置title的样式，并将滚动到的地方设置为当前
			//如果当前是隐藏的，先显示出来
			if(opt.contentId && !_imgs[cur] && (isInit==false || (isInit==true && opt.isLoadInit==true))){
				//并不能确保分页的最后一页数量为len && 如果图片未载入，并且不是初始化或是初始化且需要加载
				$loadImg(_cont[cur],opt.backAttr);
				_imgs[cur]=true;
			};
			if(opt.contentId){
				_cont[cur].style.display=="none" && (_cont[cur].style.display="block");
				_cont[cur].style.visibility=="hidden" && (_cont[cur].style.visibility="visible");
			};
			if(opt.titleId){
                //_tabs[current].className="";
                for(var i=0,len=_tabs.length;i<len;i++){
                    i!=cur && $delClass(_tabs[i],opt.className);
                }
				$addClass(_tabs[cur],opt.className);
				_tabs[cur].style.display=="none" && (_tabs[cur].style.display="block");
			};
			opt.func(cur);
		}
	}
}
function $addClass(ids,cName){
	$setClass(ids,cName,"add");	
};
function $addEvent(obj, type, handle) {
    if(!obj || !type || !handle) {
        return;
    }
    if( obj instanceof Array) {
        for(var i = 0, l = obj.length; i < l; i++) {
            $addEvent(obj[i], type, handle);
        }
        return;
    }
    if( type instanceof Array) {
        for(var i = 0, l = type.length; i < l; i++) {
            $addEvent(obj, type[i], handle);
        }
        return;
    }
    window.__allHandlers = window.__allHandlers || {};
    window.__Hcounter = window.__Hcounter || 1;
    function setHandler(obj, type, handler, wrapper) {
        obj.__hids = obj.__hids || [];
        var hid = 'h' + window.__Hcounter++;
        obj.__hids.push(hid);
        window.__allHandlers[hid] = {
            type : type,
            handler : handler,
            wrapper : wrapper
        }
    }
    function createDelegate(handle, context) {
        return function() {
            return handle.apply(context, arguments);
        };
    }
    if(window.addEventListener) {
        var wrapper = createDelegate(handle, obj);
        setHandler(obj, type, handle, wrapper)
        obj.addEventListener(type, wrapper, false);
    }
    else if(window.attachEvent) {
        var wrapper = createDelegate(handle, obj);
        setHandler(obj, type, handle, wrapper)
        obj.attachEvent("on" + type, wrapper);
    }
    else {
        obj["on" + type] = handle;
    }
};
function $child(node,val,fn,filter){
	var results=[], filter = filter||$empty();
        if(!node) return results;
		
	walk(node.firstChild,function(n){
		if(!n){return ;}
		var actual=n.nodeType===1&&n.nodeName.toLowerCase();
		if(typeof actual === 'string' && (actual === val || typeof val !== 'string') && filter(n)){
				results.push(n);
				fn&&fn(n,results.length-1);
		}
	});
	
	return results;
			
	function walk(n,func){
		func(n);
		while(n&&(n=n.nextSibling)){
			func(n,func);		
		}
	}
};
function $delClass(ids,cName){	
	$setClass(ids,cName,"remove");
};
//获取组件id对应的模板
function $getStdTemplate(str,id){
	//有cache的情况
	window["_template"]?"":window._template={};
	if(window["_template"][id]){
		return window["_template"][id];
	}
	//有自定义模板的情况
	var s=$id("template_"+id);
	s?str=s.innerHTML:"";
	var obj=$decodeTemplate(str);
	return window["_template"][id]=obj;
}
//读取标准模板并返回结构
function $decodeTemplate(str,desc){
	//去除所有的换行
	str=str.replace(/[\n\r]/g,"");
	//分解子模板
	var a=str.match(/<!--(.*?)\/\*(.*?)\*\/(.*?)\1-->/gi);
	var b={};
	var c={};
	if(!a){return [];}
	for(var i=0;i<a.length;i++){
		//读取子模板id及模板内容
		var t=a[i].match(/(.*?)\/\*(.*?)\*\/(.*)\1/i);
		b[t[1]]=$strTrim(t[3]);
		c[t[1]]=t[2];
	}
	desc==true?b._desc=c:"";
	return b;
};
function $getX(e){
//获取页面中对象的绝对X位置
	var t=e.offsetLeft || 0;
	while(e=e.offsetParent)t+=e.offsetLeft;
	return t;
}
function $getY(e){
//获取页面中对象的绝对Y位置
    var t=e.offsetTop || 0;
    while(e=e.offsetParent){
        t+=e.offsetTop;
    }
    return t;
}
function $empty(){
//返回全局空函数，不做任何事情，返回true；
   return function(){return true;}
};
function $getTarget(e,parent,tag) {
	var	e=window.event||e,
		tar=e.srcElement||e.target;
	if(parent && tag && tar.nodeName.toLowerCase()!=tag){
		while(tar = tar.parentNode){
			//对下拉框的点击会回溯到document，其它最多回溯到document.body即可
			if(tar==parent || tar==document.body || tar==document){
				return null;
			}else if(tar.nodeName.toLowerCase()==tag){
				break;
			}
		}
	};
	return tar;
};
function $hasClass(old,cur){
	if(!old||!cur) return null;
	var arr = (typeof old == 'object' ? old.className : old).split(' ');
	for(var i=0,len=arr.length;i<len;i++){
		if(cur==arr[i]){
			return cur;
		}
	};
	return null;
};
function $id(id){
	return typeof(id)=="string"?document.getElementById(id):id;
};
function $inArray(t,arr){
	if(arr.indexOf){
		return arr.indexOf(t);
	}
	for(var i=arr.length;i--;){
		if(arr[i]===t){
			return i*1;
		}
	};
	return -1;
};
function $loadImg(obj,attr){
	//载入隐藏的图片
        if(!obj) return;
	var attr=attr || "back_src",
		images = obj.getElementsByTagName("IMG");
	for(var i=0,len=images.length;i<len;i++){
		var oImg=images[i],
			src=oImg.getAttribute(attr);
		''==oImg.src && src && (oImg.src=src);
	}
};
function $preventDefault(e){
	if(e && e.preventDefault){
		e.preventDefault();
	}else{
		window.event.returnValue=false;
	};
	return false;
};
function $randomInt(num1,num2){
    //生成从num1到num2(不包括num2)之间的随机数,若只传递一个参数，则生成0到该数之间的随机数
    if(num2==undefined){
    	num2=num1;
    	num1=0;
    }
    return Math.floor(Math.random()*(num2-num1)+num1);
};
function $setClass(ids, cName, kind) {
	if(!ids) {
		return;
	}
	var set = function(obj, cName, kind) {
		if(!obj) {
			return;
		}
		var oldName = obj.className, arrName = oldName ? oldName.split(' ') : [];
		if(kind == "add") {
			if(!$hasClass(oldName, cName)) {
				arrName.push(cName);
				obj.className = arrName.join(' ');
			}
		}
		else if(kind == "remove") {
			var newName = [];
			for(var i = 0, l = arrName.length; i < l; i++) {
				if(cName != arrName[i] && ' ' != arrName[i]) {
					newName.push(arrName[i]);
				}
			}
			obj.className = newName.join(' ');
		}
	};
	if( typeof (ids) == "string") {
		var arrDom = ids.split(",");
		for(var i = 0, l = arrDom.length; i < l; i++) {
			if(arrDom[i]) {
				set($id(arrDom[i]), cName, kind);
			}
		}
	}
	else if( ids instanceof Array) {//DOM对象集合  array
		for(var i = 0, l = ids.length; i < l; i++) {
			if(ids[i]) {
				set(ids[i], cName, kind);
			}
		}
	}
	else {
		set(ids, cName, kind);
	}
}
//slider end

//$hover start
function $hover(option) {
    var opt = {
        title : null, //dom id
        content : null, //dom id
        initOnOver:$empty(),//在初次mouoseover时执行的函数（执行一次）
        overFunc : $empty(),
        outFunc : $empty(),
        timer : 100, //延时时间，毫秒
        oTimer : null//非填项，定时器对象
    };
    for(var k in option) {
        opt[k] = option[k];
    }
    var isInit = false;
    function overFunc() {
        clearTimeout(opt.oTimer);
        if(!isInit){
            opt.initOnOver();
            isInit = true;
        }
        opt.oTimer = null;
        opt.content.style.display = "block"
        opt.overFunc(opt);
    }
    function outFunc() {
        opt.oTimer = setTimeout(function() {
            opt.content.style.display = "none"
            opt.outFunc(opt);
        }, opt.timer);
    }
    $mouseover(opt.title, overFunc);
    $mouseout(opt.title, outFunc);
    $mouseover(opt.content, overFunc);
    $mouseout(opt.content, outFunc);
}
//$hover end
//float start
function $float(opt) {
	//显示浮窗,支持各种形态
	var option = {
		id : "", //string, 唯一id
		left : 0, //number
		top : 0, //number
		width : 400, //number
		height : 0, //number
		title : "", //string, 标题名称
		html : "", //string, 显示的html内容
		leaver : 2, //number,浮层等级
		zindex : 255, //number, 把zindex作为参数传入
		autoResize : false, //boolean, 自动调整高度
		cover : true, //boolean, 显示覆盖透明背景
		dragble : false, //boolean, title是否可拖动。默认不可拖动
		fix : false, //boolean, 是否固定居中随屏幕滚动
		titleId : "", //string, title的dom id
		showClose : true, //boolean, 显示关闭按钮
		closeId : "", //string, 关闭按钮的id, 支持多个id，以逗号分隔。
		bgframeLeft : -2,
		bgframeTop : -2,
		cName : "module_box_normal vt_float", //string, div容器的类名称
		style : "stand", //string, stand\none\poptip
		contentStyle : "", //string, 自定义content的style，默认是class="box_content"，无style
		cssUrl : window.config_float_css || "static/css/module_box.css", //string, 需要加载的css绝对路径，window.config_float_css为系统配置样式
		onInit : $empty(), //显示完成事件
		onClose : $empty()//关闭事件
	};
	for (var i in opt) {
		option[i] = opt[i];
	}
	var that = arguments.callee;
	option.bgframeLeft ==-2 ? (option.bgframeLeft =0):"";
	option.bgframeTop ==-2 ? (option.bgframeTop =0):"";
	//初始化
	that.data ? "" : init(option.cssUrl);
	//获得唯一标记
	option.id = option.id ? option.id : ++that.data.zIndex;
	//关闭浮层的方法
	option.close = closeFloat;
	//销毁浮层的方法
	option.destruct = destructFloat;
	//关闭同等级或者低等级的浮层
	option.closeOther = closeOther;
	//保持浮层随屏幕滚动
	option.keepBoxFix = keepBoxFix;
	//调整浮层大小
	option.resize = resize;
	//显示浮层内容
	option.show = showBox;
	//窗口定位
	option.setPos = setPos;
	//执行操作
	option.closeOther();
	//显示浮层内容
	option.show();
	that.data.list.push(option);
	//如果标题title可拖动那么执行拖动操作
	if (option.dragble) {
		$initDragItem({
			barDom : option.boxTitleHandle,
			targetDom : option.boxHandle
		});
	}
	return option;
	//关闭浮层的方法
	function closeFloat() {
		if (!option.onClose(option)) {
			return;
		}
		//关闭兄弟和子浮层
		option.closeOther();
		option.destruct();
	}

	//销毁浮层的方法
	function destructFloat() {
		var _this = this;
		//关闭低级浮层
		_this.cover ? that.data.closeCover() : "";
		if (_this.sizeTimer) {
			clearInterval(_this.sizeTimer);
		}
		if (_this.fixTimer) {
			clearInterval(_this.fixTimer);
		}
		_this.boxHandle ? document.body.removeChild(_this.boxHandle) : "";
		_this.boxHandle = null;
		for (var i = 0, l = that.data.list.length; i < l; i++) {
			if (!that.data.list[i]) {
				continue;
			}
			if (_this.id == that.data.list[i].id) {
				that.data.list[i] = null;
			}
		}
		if (_this.closeId) {
			var arrClose = _this.closeId.split(",");
			for (var l = arrClose.length; l--; ) {
				var _el = $id(arrClose[l]);
				if (_el) {
					_el.onclick = null;
					_el = null;
				}
			}
		}
	}

	//关闭同等级或者低等级的浮层
	function closeOther() {
		for (var i = 0, l = that.data.list.length; i < l; i++) {
			if (!that.data.list[i]) {
				continue;
			}
			if (that.data.list[i].leaver >= this.leaver && this.id != that.data.list[i].id) {
				that.data.list[i].destruct();
			}
		}
	}

	//显示浮层内容
	function showBox() {
		this.cover ? that.data.showCover() : "";
		var c = document.createElement("div"), content = "", _style = option.contentStyle ? (' style="' + option.contentStyle + '" ') : "";
		c.id = this.boxId = 'float_box_' + this.id;
		c.style.position = "absolute";
		//根据样式输出不同模板，有标题和关闭按钮的
		if ($isBrowser("ie6")) {
			content = '<iframe frameBorder="0" style="position:absolute;left:' + option.bgframeLeft + 'px;top:' + option.bgframeTop + 'px;z-index:-1;border:none;" id="float_iframe_' + this.id + '"></iframe>';
		}
		switch(option.style+"") {
			case "stand":
				c.className = option.cName;
				c.innerHTML = content + '<div class="box_title" id="float_title_' + this.id + '"><a href="javascript:;" style="display:' + (this.showClose ? '' : 'none') + ';"  class="bt_close" id="float_closer_' + this.id + '">×</a><h4>' + this.title + '</h4></div><div class="box_content" ' + _style + '>' + this.html + '</div>';
				break;
			case "":
				//根据样式输出不同模板,无任何样式的时候输出一个空的div
				c.className = option.cName;
				c.innerHTML = content + '<div class="box_content" ' + _style + ' id="float_title_' + this.id + '">' + this.html + '</div>';
				break;
			case "none":
				//完全空白，不含样式的模板
				c.className = "";
				c.innerHTML = content + '<div class="box_content" ' + _style + ' id="float_title_' + this.id + '">' + this.html + '</div>';
				break;
			case "new":
				c.className = option.cName;
				c.innerHTML = content + '<div class="layer_inner"><div class="layer_hd" ' + _style + ' id="float_title_' + this.id + '"><div class="layer_hd_title">' + this.title + '</div><a href="javascript:void(0);" class="layer_hd_close" id="float_closer_' + this.id + '">close</a> </div> <div class="layer_bd">' + this.html + '</div></div></div>';
				break;
		}
		document.body.appendChild(c);
		c = null;
		this.boxHandle = $id('float_box_' + this.id);
		if ($isBrowser("ie6")) {
			this.boxIframeHandle = $id('float_iframe_' + this.id);
		}
		this.boxTitleHandle = $id(option.titleId || ('float_title_' + this.id));
		this.boxCloseHandle = $id('float_closer_' + this.id);
		this.height ? (this.boxHandle.style.height = (option.height == "auto" ? option.height : option.height + "px")) : "";
		this.width ? (this.boxHandle.style.width = (option.width == "auto" ? option.width : option.width + "px")) : "";
		this.boxHandle.style.zIndex = that.data.zIndex;
		//窗口可见宽度
		this.sw = parseInt(this.boxHandle.offsetWidth);
		//窗口可见高度
		this.sh = parseInt(this.boxHandle.offsetHeight);
		//窗口定位
		this.setPos();
		var _this = this;
		//绑定关闭按钮的事件
		_this.boxCloseHandle ? _this.boxCloseHandle.onclick = function() {
			_this.close();
			return false;
		} : "";
		//绑定关闭按钮的事件
		if (_this.closeId) {
			var arrClose = _this.closeId.split(",");
			for (var l = arrClose.length; l--; ) {
				var _el = $id(arrClose[l]);
				if (_el) {
					_el.onclick = function() {
						_this.close();
						return false;
					};
					_el = null;
				}
			}
		}
		//保持浮层随屏幕滚动
		_this.keepBoxFix();
		if (!_this.onInit(option)) {
			return;
		}
	}

	function setPos(left, top) {
		//窗口定位，如果没有指定坐标则居中
		var psw = $getPageScrollWidth(), ww = $getWindowWidth(), psh = $getPageScrollHeight(), wh = $getWindowHeight();
		var p = [0, 0];
		left && (this.left = left);
		top && (this.top = top);
		p[0] = parseInt(this.left ? this.left : (psw + (ww - this.sw) / 2));
		p[1] = parseInt(this.top ? this.top : (psh + (wh - this.sh) / 2));
		//如果超出屏幕则自动移入
		//超出右侧
		(p[0] + this.sw) > (psw + ww) ? (p[0] = psw + ww - this.sw - 10) : "";
		//超出底部
		(p[1] + this.sh) > (psh + wh) ? (p[1] = psh + wh - this.sh - 10) : "";
		//超出顶部
		p[1] < psh ? p[1] = psh : "";
		//超出左侧
		p[0] < psw ? p[0] = psw : "";
		if ($isBrowser("ie6")) {
			//调整iframe的高度与浮窗一样大小
			this.boxIframeHandle.height = (this.sh - 2) + "px";
			//兼容border的存在
			this.boxIframeHandle.width = (this.sw - 2) + "px";
		}
		//显示iframe坐标
		this.boxHandle.style.left = p[0] + "px";
		this.boxHandle.style.top = p[1] + "px";
		//保持浮层随屏幕滚动
		this.keepBoxFix();
	}

	//调整浮层大小
	function resize(w, h) {
		if (w && w.constructor === Number) {
			this.sw = w;
			//窗口可见宽度
			this.boxHandle.style.width = this.sw + "px";
			if ($isBrowser("ie6")) {
				this.boxIframeHandle.width = (this.sw - 2) + "px";
			}
			//this.boxHandle.style.left = $getPageScrollWidth() + ($getWindowWidth() - this.sw) / 2 + "px";
		}
		if (h && h.constructor === Number) {
			this.sh = h;
			//窗口可见高度
			this.boxHandle.style.height = this.sh + "px";
			if ($isBrowser("ie6")) {
				this.boxIframeHandle.height = (this.sh - 2) + "px";
			}
			//this.boxHandle.style.top = $getPageScrollHeight()+($getWindowHeight()-this.sh)/2 + "px";
			//var st = this.boxHandle.style;
			//这里的position要么是absolute，要么是fixed，如果是absolute的话，设置top就需要加上scroll了
			//var filledHeight = st.position == "fixed" ? 0 : $getPageScrollHeight();
			//this.boxHandle.style.top = filledHeight + ($getWindowHeight() - this.sh) / 2 + "px";
		}
		//重定位
		this.setPos();
	}

	//保持浮层随屏幕滚动
	function keepBoxFix() {
		if (this.fix) {
			var _this = this;
			if ($isBrowser("ie6")) {
				!_this.fixTimer && (_this.fixTimer = setInterval(function() {
					_this.boxHandle.style.left = (_this.left ? _this.left : ($getPageScrollWidth() + ($getWindowWidth() - _this.sw) / 2)) + "px";
					_this.boxHandle.style.top = (_this.top ? _this.top : ($getPageScrollHeight() + ($getWindowHeight() - _this.sh) / 2)) + "px";
				}, 30));
			} else {
				_this.boxHandle.style.position = "fixed";
				_this.boxHandle.style.left = (_this.left ? _this.left : ($getWindowWidth() - _this.sw) / 2) + "px";
				_this.boxHandle.style.top = (_this.top ? _this.top : ($getWindowHeight() - _this.sh) / 2) + "px";
			}
		}
	}

	//当内容的发生变化时自动调整窗口高度
	function autoResize() {
		if (this.autoResize) {
			var _this = this;
			_this.sizeTimer = setInterval(function() {
				//窗口可见宽度
				_this.sw = _this.boxHandle.offsetWidth;
				//窗口可见高度
				_this.sh = _this.boxHandle.offsetHeight;
				//调整iframe的高度与浮窗一样大小
				if ($isBrowser("ie6")) {
					_this.boxIframeHandle.height = (_this.sh - 2) + "px";
					_this.boxIframeHandle.width = (_this.sw - 2) + "px";
				}
			}, 50);
		}
	}

	//初始化全局浮层cache
	function init(cssUrl) {
		//加载css,如果cssUrl为空则不异步加载样式
		if (cssUrl) {
			$loadCss(cssUrl);
		}
		that.data = {};
		//起始层号从255开始
		that.data.zIndex = option.zindex;
		//浮层库列表
		that.data.list = [];
		//增加一个覆盖的半透明浮层
		createCover();
		that.data.showCover = showCover;
		that.data.closeCover = closeCover;
		//创建浮层对象
		function createCover() {
			var c = document.createElement("div");
			c.id = "float_cover";
			c.style.display = "none";
			c.style.width = "0px";
			c.style.height = "0px";
			c.style.backgroundColor = "#cccccc";
			c.style.zIndex = 250;
			c.style.position = "fixed";
			c.style.hasLayout = -1;
			c.style.left = "0px";
			c.style.top = "0px";
			c.style.filter = "alpha(opacity=50);";
			c.style.opacity = "0.5";
			document.body.appendChild(c);
			if ($isBrowser("ie6")) {
				c.innerHTML = '<iframe frameBorder="0" style="position:absolute;left:0;top:0;width:100%;z-index:-1;border:none;" id="float_cover_iframe"></iframe>';
				c.style.position = "absolute";
			}
			that.data.cover = $id("float_cover");
			that.data.coverIframe = $id("float_cover_iframe");
			that.data.coverIsShow = false;
			that.data.coverSize = [0, 0];
			c = null;
		}

		//显示灰色浮层背景对象
		function showCover() {
			that.data.cover.style.display = "block";
			that.data.coverIsShow = true;
			keepCoverShow();
			that.data.coverTimer = setInterval(function() {
				keepCoverShow();
			}, 50);
			//保持浮层的全屏幕覆盖尺寸
			function keepCoverShow() {
				var _d = that.data;
				if (_d.coverIsShow) {
					var ch = $getContentHeight(), wh = $getWindowHeight(), cw = $getContentWidth(), ww = $getWindowWidth(), ns = [wh, ww];
					if ($isBrowser("ie6")) {
						_d.cover.style.top = $getPageScrollHeight() + "px";
					}
					if (ns.toString() != that.data.coverSize.toString()) {
						_d.coverSize = ns;
						_d.cover.style.height = ns[0].toFixed(0) + "px";
						_d.cover.style.width = ns[1].toFixed(0) + "px";
						if (_d.coverIframe) {
							_d.coverIframe.style.height = ns[0].toFixed(0) + "px";
							_d.coverIframe.style.width = ns[1].toFixed(0) + "px";
						}
					}
				}
			}

		}

		//关闭灰色浮层背景对象
		function closeCover() {
			that.data.cover.style.display = "none";
			that.data.coverIsShow = false;
			clearInterval(that.data.coverTimer);
		}
	}
}
//float end